package com.guigu.yh.springcloud.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * 应用程序上下文配置
 *
 * @author 张颖辉（zyh）
 * @version 1.0.0
 * @date 2022/08/19
 */
@Configuration
public class ApplicationContextConfig {

    @Bean
    @LoadBalanced //开启负载均衡注解，默认轮询，consul缺少这个注解会报错：UnknownHostException："http://cloud-provider-consul-payment"
    public RestTemplate getRestTemplate() {
        return new RestTemplate();
    }
}
